package com.zhfi.dataapply.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class DateTimeUtil {

    private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
    private static final SimpleDateFormat timeFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    public static String transToDateString(Date date){
        return dateFormat.format(date);
    }

    public static Date transToDateTime(String dateTimeString) throws ParseException {
        return timeFormat.parse(dateTimeString);
    }

}
